layui.config({
    base: CXL.ctxPath + '/layuiadmin/' //静态资源所在路径
}).extend({
    index: 'lib/index' //主入口模块
}).use(['index', 'table', 'laydate'], function () {
    var admin = layui.admin;
    var table = layui.table;
    var laydate = layui.laydate;
    var $ = layui.$;

    drawCoordinate(cellCanvasCtx);

});


//全局变量区
var cellCanvas = document.getElementById("cellcanvas");
// var craneCanvas = document.getElementById("cranecanvas");
var cellCanvasCtx = cellCanvas.getContext('2d');
// var craneCanvasCtx = craneCanvas.getContext('2d');




//公共方法区z
/**
 * 绘制坐标系
 * create by: pzy
 * create time: 2021/11/29 14:16
 * @Param: canvas.ctx(画板),x(坐标x),y(坐标y),unit(单位)
 */
function drawCoordinate(ctx){

    /*计算原点*/
    var canvasWidth=ctx.canvas.width;
    var canvasHeight=ctx.canvas.height;
    var space = 20;
    var arrowSize = 20;

    var x0=20;
    var y0=canvasHeight-20;


    /*绘制x轴*/
    ctx.beginPath();
    ctx.moveTo(x0,y0);
    ctx.lineTo(canvasWidth-20,y0);

    /*箭头*/
    ctx.lineTo(canvasWidth-space-arrowSize,y0+arrowSize/2);
    ctx.lineTo(canvasWidth-space-arrowSize,y0-arrowSize/2);
    ctx.lineTo(canvasWidth-space,y0);
    ctx.fill();
    ctx.stroke();

    /*绘制y轴*/
    ctx.beginPath();
    ctx.moveTo(x0,y0);
    ctx.lineTo(space,space);
    /*箭头*/
    ctx.lineTo(space-arrowSize/2,space+arrowSize);
    ctx.lineTo(space + arrowSize / 2, space + arrowSize);
    ctx.lineTo(space,space);
    ctx.fill();
    ctx.stroke();



}

/**
 * create by: pzy
 * description: 改变canvas坐标原点位置
 * create time: 2021/11/29 14:29
 *
  * @Param: null
 * @return
 */
function changeCoordinateSystemVertice(location){


}

/**
 * create by: pzy
 * description: 绘制库区全图
 * create time: 2021/11/29 15:52
 * 
 * @Param: null
 * @return 
 */
function drawCell(){


}

/**
 * create by: pzy
 * description: 获取库区信息
 * create time: 2021/12/3 10:00
 *
  * @Param: null
 * @return
 */
function getcellMap(){

}

